home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Design
/
WB Collection.iso
/
workbench werkzeuge
/
memory & system tools
/
copymemquicker
/
source
/
copymemquicker.asm
< prev
next >
Wrap
Assembly Source File
|
1996-04-07
|
3KB
|
117 lines
nolist
**********************************************************************
* CopyMemQuicker 2.8 - (C) 1991-1994 Arthur Hagen *
* Parts of code: (C) 1985-1991 Commodore Business Machines Ltd. *
* Posted to the Public Domain *
**********************************************************************
include 'exec/execbase.i'
include 'exec/memory.i'
public _QuickMem
list
_QuickMem
movea.l (4).w,a6 ; ExecBase
lea dosname(pc),a1
jsr _LVOOldOpenLibrary#(a6) ; Any version will do
movea.l d0,a5
exg.l a5,a6
jsr _LVOOutput#(a6)
exg.l a5,a6
move.l d0,d5
moveq #title_end-title,d3
lea title(pc),a0
bsr.s wrt
movea.l _LVOCopyMem#+2(a6),a3
cmpi.l #'*Art',-(a3)
beq.s isquicker
moveq #0,d4
moveq #0,d6
moveq #0,d7
move.b AttnFlags+1(a6),d0
btst #AFB_68020,d0
bne.s has020
btst #AFB_68010,d0
bne.s has010
move.w #CopyLen00#,d4
move.w #Quicker00#,d6
move.w #Quickest00#,d7
lea Start00#(pc),a2
bra.s allocit
has010 move.w #CopyLen10#,d4
move.w #Quicker10#,d6
move.w #Quickest10#,d7
lea Start10#(pc),a2
bra.s allocit
has020 move.w #CopyLen20#,d4
move.w #Quicker20#,d6
move.w #Quickest20#,d7
lea Start20#(pc),a2
allocit moveq #24,d0
add.l d4,d0
move.l #(MEMF_PUBLIC|MEMF_FAST),d1
jsr _LVOAllocMem#(a6)
tst.l d0
beq.s nomem
addq.l #8,d0
addq.l #7,d0
moveq #$fffffff0,d1
and.l d1,d0 ; we now have an address modulo 16
addq.l #4,d0
move.l d0,a3
lea 8(a3),a4
movea.l a2,a0
movea.l a4,a1
move.l d4,d0
jsr (a2,d6.w) ; new CopyMemQuicker
move.l d7,d0
add.l a4,d0
bsr.s setcmq
move.l d0,(a3)+
move.l d6,d0
add.l a4,d0
bsr.s setcm
move.l d0,(a3)+
quit movea.l a5,a1
jmp _LVOCloseLibrary#(a6) ; faster than jsr + rts
nomem moveq #memerr_end-memerr,d3
lea memerr(pc),a0
pea quit(pc) ; faster than 'bsr.s wrt' + 'bra.s quit'
wrt move.l a0,d2
move.l d5,d1
exg.l a5,a6
jsr _LVOWrite#(a6)
exg.l a5,a6
rts
isquicker
moveq #already_end-already,d3
lea already(pc),a0
bsr.s wrt
move.l -(a3),d0
bsr.s setcm
move.l -(a3),d0
pea quit(pc) ; faster than 'bsr.s setcmq' + 'bra.s quit'
setcmq lea (_LVOCopyMemQuick#).w,a0
bra.s setit
setcm lea (_LVOCopyMem#).w,a0
setit movea.l a6,a1
jmp _LVOSetFunction#(a6)
************************************************************
version dc.b '$VER: '
title dc.b 'CopyMemQuicker 2.8 (12.6.94)',$0A,$0D
dc.b 'Copyright ',$A9,' 1992 Arthur Hagen.',$0A
title_end
already dc.b 'Restoring vectors.',$0A
already_end
memerr dc.b 'No FAST memory!',$0A
memerr_end
dosname dc.b 'dos.library',0
even